package databaseService;

import java.rmi.RemoteException;

import javax.swing.table.DefaultTableModel;

import dBInfo.DeleteLimitation;
import dBInfo.GetTableLimitation;
import dBInfo.InsertLimitation;
import dBInfo.UpdateLimitation;
import useDataBase.DeleteInfo;
import useDataBase.GetTable;
import useDataBase.InsertInfo;
import useDataBase.UpdateTable;
import useDataBaseService.DeleteInfoImpli;
import useDataBaseService.GetTableImpli;
import useDataBaseService.InsertInfoImpli;
import useDataBaseService.UpdateTableImpli;

public class LockInfoDataService {
	private InsertInfoImpli insertInfo;
	private GetTableImpli getTable;
	private UpdateTableImpli updateTable;
	private DeleteInfoImpli deleteInfo;
	private String locktable = "lockinfo"; 
	
	
	public LockInfoDataService() {
		// TODO Auto-generated constructor stub
		insertInfo = new InsertInfo();
		getTable = new GetTable();
		updateTable = new UpdateTable();
		deleteInfo=new DeleteInfo();
	}
	

	public void insert(InsertLimitation info) throws RemoteException {
		insertInfo.insert(locktable, info.getInsertInfo());
	}

	public DefaultTableModel getTable(GetTableLimitation getTableLimitation)
			throws RemoteException {
		return getTable.getTable(locktable,
				getTableLimitation.getColumns(),
				getTableLimitation.getConditions());
	}

	public void update(UpdateLimitation updateLimitation)
			throws RemoteException {
		
		updateTable.updataInfo(locktable,
				updateLimitation.getUpadteInfo(),
				updateLimitation.getConditions());
	}

	public void deletePersonalInfo(DeleteLimitation deleteLimitation)
			throws RemoteException {
		
		deleteInfo.deleteInfo(locktable,
				deleteLimitation.getCondition());
	}
}
